Page({
  data: {
    students: [
      { id: 1, name: '张三', parent: '家长A' },
      { id: 2, name: '李四', parent: '家长B' }
    ],
    newName: '',
    newParent: '',
    activeTab: 1
  },
  onNameInput(e) {
    this.setData({ newName: e.detail.value });
  },
  onParentInput(e) {
    this.setData({ newParent: e.detail.value });
  },
  addStudent() {
    const { newName, newParent, students } = this.data;
    if (!newName) return;
    students.push({ id: students.length + 1, name: newName, parent: newParent });
    this.setData({ students, newName: '', newParent: '' });
  }
}); 